package com.ssm.stu.dao;

import com.ssm.stu.pojo.Major;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface MajorDao {

    @Insert("insert into tb_major (major_id, major_name, tuition, dept_id) " +
            "values (#{majorId},#{majorName},#{tuition},#{deptId});")
    int insertMajor(Major major);

    @Update("update tb_major set major_name = #{majorName},major_id=#{majorId},tuition = #{tuition} ,tb_major.dept_id = #{deptId} " +
            "where major_id = #{majorId};")
    int updateMajor(Major major);

    @Delete("delete from tb_major where major_id = #{majorId};")
    int deleteMajor(String  id);

    @Select("select * from tb_major where major_id = #{majorId};")
    Major selectMajorById(String  id);

    @Select("select * from tb_major;")
    List<Major> selectAllMajor();
}
